package com.wlts.wzy.Base;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

public class BaseIgnoreField {


    private static final String[] IGNORE = {"id", "currentPage","pageSize","createDate","updateDate","updateBy","delFlag","endTime","remarks"};

    /**
     * 需要忽略的字段
     */
    public static String[] permitAllIGNORE(String... urls) {
        if (urls == null || urls.length == 0) {
            return IGNORE;
        }

        Set<String> set = new HashSet<>();
        Collections.addAll(set, IGNORE);
        Collections.addAll(set, urls);

        return set.toArray(new String[0]);
    }

    public static String[] deleteAllIGNORE(String... urls) {
        if (urls == null || urls.length == 0) {
            return IGNORE;
        }

        Set<String> set = new HashSet<>();
        Collections.addAll(set, IGNORE);
        Set<String> delSet = new HashSet<>();
        Collections.addAll(delSet, urls);
        set.removeAll(delSet);

        return set.toArray(new String[0]);
    }

}
